import React, { Component } from 'react'
import OfflineMsgList from './OfflineMsgList'
import style from './OfflineMsg.module.scss'
import { connect } from "react-redux";
import { removeEmptyField } from '../../compoent/emptyFild'
import moment from 'moment';
import AddInfo from './component/AddInfo'
import {
    Form,
    Input,
    Button,
    Modal,
    TimePicker,
    DatePicker,
    Select,

} from 'antd';
const { RangePicker } = DatePicker;
const { Option } = Select;

class OfflineMsg extends Component {
    state = {
        visible: false,
        type: ''

    }
    componentDidMount() {
        // this.props.list({ page: 1, size: 10 })
    }
    onFinish = (values) => {

    };
    onFinishFailed = (errorInfo) => {

    };

    handleCancel = () => {
        this.setState({
            visible: false
        })
    }
    addInfo = () => {
        this.setState({ visible: true, type: '0' })
    }
    render() {
        const { RangePicker } = DatePicker;
        const { visible } = this.state

        //
        return (
            <div>
                <div className={style.top}>
                    <Form
                        style={{ marginTop: 20, marginLeft: 20 }}
                        name="basic"
                        layout='inline'
                        // wrapperCol={{ span: 6 }}
                        onFinish={this.onFinish}
                        autoComplete="off"

                    >

                        <Form.Item style={{ marginLeft: 100, marginTop: 0 }}>
                            <Button onClick={this.addInfo} type="primary" style={{ marginLeft: 30 }}>
                                新增
                            </Button>
                        </Form.Item>
                    </Form>
                </div>
                <div className={style.middle}>
                    <OfflineMsgList/>

                </div>
                <div>
                    <Modal destroyOnClose visible={visible} title='新增' footer={null} onCancel={this.handleCancel} handleCancel={this.handleCancel}>
                        <AddInfo handleCancel={this.handleCancel} ></AddInfo>
                    </Modal>
                </div>
            </div>
        )
    }
}
const mapState = state => ({
    ...state.systemInfo

});

const mapDispatch = dispatch => ({
    ...dispatch.systemInfo
})

export default connect(mapState, mapDispatch)(OfflineMsg);